ostree commit: Fix combining trees with multiple --tree=ref arguments
authorWilliam Manley <will@williammanley.net>
Tue, 19 Jul 2016 02:14:26 +0000 (03:14 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 17 Nov 2016 14:45:55 +0000 (14:45 +0000)
commit0ee9e221beecd2261f75da46afa02d54b1230886
treeb9371c4bea47fd204422a6713323f3ebea5c4681
parent24bf257ee9f16959a6f480c7c1c16cdbe4aabc91
ostree commit: Fix combining trees with multiple --tree=ref arguments

You'd expect

    ostree commit --tree=ref=A --tree=ref=B

to produce a commit with the union of the trees given.  Instead you'd get
a commit with the contents of just the latter commit.  This was due to an
optimisation where we'd skip filling out the `files` and `subdirs`
members of the mtree, just filling in the metadata instead.  This backfires
becuase this same code relies on checking the `files` and `subdirs` members
itself to work out whether the mtree is empty.

This commit removes the optimisation, fixing the bug.  Maybe there's a way
to keep the optimisation and still fix the bug but it's not obvious to
me.

Closes: #581
Approved by: cgwalters
src/libostree/ostree-repo-commit.c
tests/basic-test.sh